require(['./config'], () => {
    require(['jquery', 'artTemplate', 'loadHeaderFooter'], ($, template) => {
        class Allproducts{
            constructor(){
              this.menus()
              this.getlipglosslist()
              this.getlippielist()
              this.getairpillowlist()
              this.getperfumelist()
            }
            menus(){
              $('#menus').hover(() => {
                  $('#select').show()
              }),() => {
                  $('#select').css('display','none')
              }
            }
            getlipglosslist(){
              $.get('http://www.xiongmaoyouxuan.com/api/search?word=%E9%98%BF%E7%8E%9B%E5%B0%BC%E5%94%87&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=0',resp=>{
                if(resp.code===200){
                  let{list} = resp.data
                  let listgloss = list
                //   console.log(listgloss);
                  const html = template('getlipglossTemplate', { listgloss })
                  $('#lipglossList').html(html)
                }
              })
            }
            getlippielist(){
              $.get('http://www.xiongmaoyouxuan.com/api/search?word=%E9%98%BF%E7%8E%9B%E5%B0%BC%E5%8F%A3%E7%BA%A2&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=0',resp=>{
                if(resp.code===200){
                  let{list} = resp.data
                  let listpie = list.slice(2,4)
                  const html = template('getlippieTemplate', { listpie })
                  $('#lippieList').html(html)
                }
              })
            }
            getairpillowlist(){
              $.get('http://www.xiongmaoyouxuan.com/api/search?word=%E9%98%BF%E7%8E%9B%E5%B0%BC%E7%B2%89%E5%BA%95&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=0',resp=>{
                if(resp.code===200){
                  let{list} = resp.data
                  // console.log(resp);
                  let listair = list
                  // console.log(listair);
                  const html = template('getairpillowTemplate', { listair })
                  $('#airpillowList').html(html)
                }
              })
            }
            getperfumelist(){
              $.get('http://www.xiongmaoyouxuan.com/api/search?word=%E9%98%BF%E7%8E%9B%E5%B0%BC%E9%A6%99%E6%B0%B4&start=0&sort=0&couponOnly=0&minPrice=0&maxPrice=0',resp=>{
                if(resp.code===200){
                  let{list} = resp.data
                  let listper = list.slice(0,3)
                  const html = template('getperfumeTemplate', { listper })
                  $('#perfumeList').html(html)
                }
              })
            }
          }
          new Allproducts()
    })
})